home *** CD-ROM | disk | FTP | other *** search
/ Amiga Desktop Video CD / Amiga DeskTop Video CD.iso / install / forceicon / source / checktooltypes.h next >
C/C++ Source or Header  |  1994-06-23  |  1KB  |  64 lines

  1.  
  2. /**********************************************************************/
  3. /*              Check for tooltypes or commandline args,              */
  4. /*                   returning TRUE for FlushMemory                   */
  5. /**********************************************************************/
  6. #ifdef PREFSRUN
  7. static char *Template = "FLUSH=FLUSHMEMORY/S";
  8. #endif
  9. static void CheckToolTypes(struct WBStartup *WBenchMsg)
  10. {
  11.     ObtainSemaphore(&FIconSema->FIconSema);
  12.  
  13.         // Launched from WB ???
  14.  
  15.     if(WBenchMsg)
  16.     {
  17.         struct    DiskObject    *MyDObj;
  18.         struct    WBArg        *MyWBArg;
  19.         BPTR            OldDir;
  20.  
  21.         MyWBArg        = WBenchMsg->sm_ArgList;
  22.  
  23.         OldDir        = CurrentDir(MyWBArg->wa_Lock);
  24.  
  25.         if((MyDObj = GetDiskObjectNew(MyWBArg->wa_Name)))
  26.         {
  27. #ifdef PREFSRUN
  28.             FlushMemory            = (FindToolType(MyDObj->do_ToolTypes, "FLUSHMEMORY") != NULL);
  29. #endif
  30.             FreeDiskObject(MyDObj);
  31.         }
  32.  
  33.         CurrentDir(OldDir);
  34.     }
  35.  
  36.         // Check command line
  37.  
  38.     else
  39.     {
  40.         APTR        *Args;
  41.         struct    RDArgs    *MyRDArgs;
  42.  
  43.         if((Args = AllocVec(2 * sizeof(ULONG), MEMF_CLEAR)))
  44.         {
  45.             if((MyRDArgs = ReadArgs(Template, (LONG *)Args, NULL)))
  46.             {
  47. #ifdef PREFSRUN
  48.                 FlushMemory        = (Args[0] != NULL);
  49. #endif
  50.  
  51.                 FreeArgs(MyRDArgs);
  52.             }
  53.             else
  54.                 DisplayError(IoErr(), NULL);
  55.  
  56.             FreeVec(Args);
  57.         }
  58.         else
  59.             DisplayError(ERR_NOMEM, NULL);
  60.     }
  61.  
  62.     ReleaseSemaphore(&FIconSema->FIconSema);
  63. }
  64.